﻿using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;

public class TestProjectEvent : UnityEditor.AssetModificationProcessor
{
    public static void OnWillCreateAsset(string path) {
        Debug.LogFormat("创建资源:{0}",path);

    }

    public static string[] OnWillSaveAssets(string[] paths) {

        for (int i = 0; i < paths.Length; i++)
        {
            Debug.LogFormat("保存资源:{0}", paths[i]);

        }

        return paths;
    }

    public static AssetMoveResult OnWillMoveAsset(string oldPath,string newPath) {

        Debug.LogFormat("移动资源:从{0}移动到{1}", oldPath, newPath);

        return AssetMoveResult.DidNotMove;
    }

    public static AssetDeleteResult OnWillDeleteAsset(string path,RemoveAssetOptions options) 
    {

        Debug.LogFormat("删除资源 : {0} Option : {1}", path, options);

        
        
        return AssetDeleteResult.DidNotDelete;// 可以删除
    }

    [InitializeOnLoadMethod]
    static void InitOnLoad() {
        EditorApplication.projectChanged += () => {
            Debug.Log(" Asset Change!  ");
        };
    }

}
